# Python 2.6.4
# Project Euler, Problem 39
# Copyright 2010 Talha Zaman

pyth = set()
for i in range(1,500):
    for j in range(1,i):
        a, b, c, n = 2*i*j, i**2 - j**2, i**2 + j**2, 1
        if b<a: a,b=b,a
        while n*(a+b+c)<1000:
            pyth.add((n*a,n*b,n*c))
            n += 1
            
num = [0 for i in range(1000)]
for p in pyth:
    num[sum(p)] += 1

print num.index(max(num))
print max(num)
